package com.hzz.mybatisplusdemo.config.sqlInjector;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.baomidou.mybatisplus.core.metadata.TableInfo;

import java.util.List;

/**
 * 自定义sql注入器，增加通用方法
 */
public class GeneralMybatisPlusSqlInjector extends DefaultSqlInjector {


    @Override
    public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {

        List<AbstractMethod> methodList = super.getMethodList(mapperClass,tableInfo);

        // 根据id更新所有数据
        methodList.add(new UpdateAllColumnById());
        return methodList;
    }
}
